package com.zhongyu.comm.util;


import com.zhongyu.comm.vo.Result;
import lombok.extern.slf4j.Slf4j;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//控制层全局异常处理器
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    public Result handleException(RuntimeException ex){
        log.error("全局异常处理器捕获到异常!",ex);

        return Result.failure("用户操作失败！");
    }

   /* @ExceptionHandler(AuthException.class)
    public Result handleException(AuthException ex){
        log.error(ex.getMessage(),ex);

        return Result.failure(ex.getMessage(),ErrorCode.LOGIN_ERROR);
    }*/


}
